package com.yunshang.shoppingmall.controller;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yunshang.shoppingmall.common.layuiJson;
import com.yunshang.shoppingmall.entity.Freight;
import com.yunshang.shoppingmall.service.FreightService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class FreightController {
    @Autowired
    FreightService freightService;
    @RequestMapping("/getFreightList")
    @ResponseBody
    //订单列表
    public String getFreightList(int page,int limit)
    {
        System.out.println(page+"ssss"+limit);
        PageHelper.startPage(page,limit);
        List<Freight> freightList=freightService.selectAll();
        System.out.println(freightList.size());
        PageInfo page1 = new PageInfo(freightList);
        return layuiJson.layuiJsonList(freightList,(int)page1.getTotal());
    }

    @RequestMapping("/freightList")
    public String freightList()
    {
        return "freight/freightList";
    }
}
